package com.utils
{
	public class Collide
	{
		public var quality:Number;//质量
		public var attack:Number;//攻击力
		public var move:int;
		
		
		private var _speed:Number;//加速度
		private var _speedx:Number;
		private var _speedy:Number;
		private var _angle:Number;//角度
		
		//(设置质量、攻击力)
		public function Collide()
		{
			angle = 0;
			speed = 0;
			quality = 0;
			attack = 0;
		}
		
		
		public function get speed():Number{
			return _speed;
		}
		public function set speed(value:Number):void{
			_speed = value;
			_speedx = speed * Math.cos(_angle);
			_speedy = speed * Math.sin(_angle);
		}//close get set
		public function get speedx():Number{
			return _speedx;
		}
		public function get speedy():Number{
			return _speedy;
		}
		
		public function get angle():Number{
			return _angle;
		}
		public function set angle(value:Number):void{
			//周期换算
			while(value < 0){
				value += Math.PI*2;
			}
			while(value > 2*Math.PI){
				value -= 2*Math.PI;
			}
			_angle = value;
			if (_angle == 0){
				trace("角度", _angle); 
			}
			
			_speedx = speed * Math.cos(_angle);
			_speedy = speed * Math.sin(_angle);
		}//close get set
	}
}